/*
 * @Author: Penk
 * @LastEditors: Penk
 * @LastEditTime: 2022-12-28 11:32:23
 * @FilePath: \penk-ui\src\components\PenkSearch\PenkSearch.test.ts
 * @Desc: 这边引用了PenkSelect，但是没有加载elementPlus... 所以会报错
 *        If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
 * @email: 492934056@qq.com
 */
import PenkSearch from "./PenkSearch.vue";
import { render, screen, fireEvent } from "@testing-library/vue";

test("penkSearch Bar has input item", async () => {
  // The `render` method renders the component into the document.
  // It also binds to `screen` all the available queries to interact with
  // the component.
  const placeholder = "请输入姓名";
  const label = "姓名";
  render(PenkSearch, {
    props: {
      searchConfig: [
        {
          type: "input",
          label: label,
          placeholder: placeholder,
          width: 150,
          prop: "userName",
        },
      ],
    },
  });

  // 判断是否会显示label，PenkSelect后面是追加了中文冒号 ：
  expect(screen.getByText(label + "："));
  // 判断是否存在placeholder
  let input = screen.getByPlaceholderText(placeholder);
  expect(input).toBeTruthy();

  // fireEvent.change(input, {target: {value: 'penk'}})
});
